<style>
    /*不显示秒*/
    .layui-laydate-content>.layui-laydate-list {
        padding-bottom: 0px;
        overflow: hidden;
    }
    .layui-laydate-content>.layui-laydate-list>li{
        width:50%
    }

    .merge-box .scrollbox .merge-list {
        padding-bottom: 5px;
    }
</style>
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">

        <div class="layui-form-item">
            <label class="layui-form-label">任务名</label>
            <div class="layui-input-block">
                <input name="name" value='{$vo.name|default=""}' required placeholder="请输入任务名" class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">执行命令</label>
            <div class="layui-input-block">
                <input name="cmd" value='{$vo.cmd|default=""}' required placeholder="请输入执行命令"
                       class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">desc</label>
            <div class="layui-input-block">
                <input name="desc" value='{$vo.desc|default=""}' required placeholder="请输入简介" class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">参数</label>
            <div class="layui-input-block">
                <input name="parameter" value='{$vo.parameter|default=""}' required placeholder="参数"
                       class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">任务类型 </label>
            <div class="layui-input-block">
                <label>
                    <input type="radio" name="type" value="1" required title="分钟级任务" onclick="click_date_time(0)" {if isset($vo.type) && $vo.type==1 }checked{/if}>
                </label>
                <label>
                    <input type="radio" name="type" value="2" required title="指定时间任务" onclick="click_date_time(1)" {if isset($vo.type) && $vo.type==2 }checked{/if}>
                </label>
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item" id="timeBox" style="display: none;">
            <label class="layui-form-label">指定时间</label>
            <div class="layui-inline"> <!-- 注意：这一层元素并不是必须的 -->
                <input type="text" class="layui-input" id="timeBoxs" value='{$vo.do_time|default=""}'>
            </div>
        </div>
        <input type="hidden" name="do_time" class="layui-input" id="do_time" value='{$vo.do_time|default=""}'>

        <div class="layui-form-item">
            <label class="layui-form-label">状态 </label>
            <div class="layui-input-block">
                <input type="radio" name="status" value="1" required title="正常" {if isset($vo.status) && $vo.status==1 }checked{/if}>
                <input type="radio" name="status" value="2" required title="关闭" {if isset($vo.status) && $vo.status==2 }checked{/if}>
                <p class="help-block"></p>
            </div>
        </div>

    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>
</form>
<script>
    form.render();
</script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#timeBox', //指定元素
            format: 'yyyy-MM-dd HH:mm', //可任意组合
            type:'datetime',
            ready: function(){ $(".laydate-time-list li").eq(2).remove();},
            done: function(value, date, endDate){
                $('#timeBoxs').val(value);
                $('#do_time').val(value);
            }
        });

    });

    function click_date_time(num) {
        console.log(11, num)
        if (num == 1) {
            $('#timeBox').show()
        } else {
            $('#timeBox').hide()
        }

    }
</script>



